package com.youlin.controller;

import com.youlin.dto.BaseDataResDto;
import com.youlin.dto.BaseResDto;
import com.youlin.dto.Status;
import com.youlin.dto.res.AdminResDto;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@ApiSort(1)
@Api(tags = {"1 - 登录接口"})
@RestController
public class SecurityLoginController {

    @PostMapping("/login")
    @ApiOperationSort(1)
    @ApiOperation(value = "1 - SpringSecurity登录", notes = "响应参数：status-message = {" +
            "1003-账号或密码错误，1004-当前登录账户已禁用，1024-登录单位编号错误}")
    @ApiImplicitParams({
            @ApiImplicitParam(name="name", value="单位编码_登录账号", required=true, paramType="form"),
            @ApiImplicitParam(name="pwd", value="登录密码", required=true, paramType="form"),
    })
    public BaseDataResDto<AdminResDto> securityLogin (@RequestParam("name") String name,
                                                      @RequestParam("pwd") String pwd) {
        return new BaseDataResDto<>(Status.SUCCESS);
    }

    @PostMapping("/logout")
    @ApiOperationSort(2)
    @ApiOperation(value = "2 - SpringSecurity登出")
    public BaseResDto securityLogout () {
        return new BaseResDto<>(Status.SUCCESS);
    }

}
